home *** CD-ROM | disk | FTP | other *** search
- property cursorGod, objectSprite, objectRect, objectPict, mouseIsDown, mouseIn, buttonIsOn, onPict, upPict, downPict, offPict, sendsEvent, eventCatcher
-
- on mouseEvent me, xEvent, xLoc
- case xEvent of
- #mouseEnter:
- if mouseIsDown then
- set objectPict to downPict
- else
- set objectPict to upPict
- end if
- set mouseIn to 1
- #mouseLeave:
- set objectPict to onPict
- set mouseIn to 0
- #mouseDown:
- set objectPict to downPict
- set mouseIsDown to 1
- #mouseUp:
- if mouseIn then
- set objectPict to upPict
- else
- set objectPict to onPict
- end if
- set mouseIsDown to 0
- if buttonIsOn then
- catchEvent(eventCatcher, sendsEvent)
- end if
- #mouseGone:
- set objectPict to onPict
- set mouseIsDown to 0
- set mouseIn to 0
- end case
- if buttonIsOn then
- set the member of sprite objectSprite to objectPict
- updateStage()
- end if
- end
-
- on areYouThere me, xLoc
- if inside(xLoc, objectRect) then
- return 1
- end if
- return 0
- end
-
- on turnON me
- if not buttonIsOn then
- set buttonIsOn to 1
- set the member of sprite objectSprite to objectPict
- end if
- end
-
- on turnOff me
- if buttonIsOn then
- set buttonIsOn to 0
- set the member of sprite objectSprite to offPict
- end if
- end
-
- on new me, xSprite
- set objectSprite to xSprite
- set objectRect to the rect of sprite objectSprite
- set buttonIsOn to 0
- set mouseIn to 0
- puppetSprite(objectSprite, 1)
- return me
- end
-
- on setPicts me, pictList
- set onPict to getAt(pictList, 1)
- set upPict to getAt(pictList, 2)
- set downPict to getAt(pictList, 3)
- set offPict to getAt(pictList, 4)
- set objectPict to onPict
- end
-
- on linkUp me, xCatcher, xSymbol
- set eventCatcher to xCatcher
- set sendsEvent to xSymbol
- end
-
- on subscribe me, xCursor
- if cursorGod = 0 then
- nothing()
- else
- unsubscribe(cursorGod, me)
- end if
- set cursorGod to xCursor
- subscribe(cursorGod, me)
- end
-
- on unsubscribe me
- if cursorGod = 0 then
- nothing()
- else
- unsubscribe(cursorGod, me)
- end if
- end
-
- on destroy me
- unsubscribe(me)
- puppetSprite(objectSprite, 0)
- set me to 0
- end
-